package com.huarui.partner.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.ewaf.framework.model.ListModel;
import org.ewaf.framework.service.BaseService;
import com.huarui.partner.dao.IPartnerAddressDao;
import com.huarui.partner.model.PartnerAddress;

public class PartnerAddressService extends BaseService {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private IPartnerAddressDao getDao() {
		return (IPartnerAddressDao) dao;
	}

	public List<PartnerAddress> getPartnerAddressByPartnerId(Integer partnerId) {

		List<PartnerAddress> partnerAddressList = this.getDao()
				.getPartnerAddressByPartnerId(partnerId);

		return partnerAddressList;

	}

	public ListModel<PartnerAddress> getPartnerAddressByConditon(ListModel<PartnerAddress> padListModel, Integer partnerId,String queryParam) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("partnerId", partnerId);
		map.put("queryParam", queryParam);
		padListModel.setTotal(getDao().getPartnerAddressCountByCondition(map));
		map.put("listModel", padListModel);
		List<PartnerAddress> partnerAddresses = getDao().getPartnerAddressByCondition(map);
		padListModel.setResult(partnerAddresses);
		return padListModel;
	}

}
